04. Building a Kinematic Model

04 L Building A Kinematic Model

00:00
00:00

Based on the above visual answer the following quizzes:

Which equation correctly models x?

SOLUTION: x=xt+vcos(psi)dt x = x_t + v * cos(psi) * dt

Which equation correctly models y?

SOLUTION: y=y+vsin(psi)dt y = y + v * sin(psi) * dt

Next, let's turn our attention to ψ \psi :

ψt+1=ψt+vLfδdt \psi_{t+1} = \psi_{t} + \frac{v} { L_f} * \delta * dt

In a nutshell, we add a multiplicative factor of the steering angle, δ \delta to ψ \psi .

Lf L_f measures the distance between the center of mass of the vehicle and it's front axle. The larger the vehicle, the slower the turn rate.

If you've driven a vehicle you're well aware at higher speeds you turn quicker than at lower speeds. This is why v v is the included in the update.

Finally, let's take a look at how the velocity, v is modeled:

v=v+adt v = v + a*dt

where a can take value between and including -1 and 1.

Awesome! We've now defined the state, actuators and how the state changes over time based on the previous state and current actuator inputs.

Here it is:

xt+1=xt+vtcos(ψt)dt x_{t+1} = x_t + v_t cos(\psi_t) * dt

yt+1=yt+vtsin(ψt)dt y_{t+1} = y_t + v_t sin(\psi_t) * dt

ψt+1=ψt+vtLfδtdt \psi_{t+1} = \psi_t + \frac {v_t} { L_f} \delta_t * dt

vt+1=vt+atdt v_{t+1} = v_t + a_t * dt

How Lf L_f was chosen for this project:

On the topic of running a vehicle around in a circle, this is actually a good way to test the validity of a model! If the radius of the circle generated from driving the test vehicle around in a circle with a constant velocity and steering angle is similar to that of your model in the simulation, then you're on the right track. This type of approach was used to tune Lf L_f .

From the image below, we can see that the vehicle started at the origin, oriented at 0 degrees. We then simulated driving with a δ \delta value of 1 degree and adjusted Lf L_f to arrive at a final value of 2.67 . This is the value that produced a circle, with all other variables held constant.